<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var numSquares = function (n) {
      let dp = [0]
      for (let i = 1; i <= n; i++) {
        dp[i] = i
        for (let j = 1; j * j <= i; j++) {
          dp[i] = Math.min(dp[i], dp[i - j * j] + 1)
        }
      }
      return dp[n]
    };
    console.log(numSquares(9))
    console.log(Math.min())
  </script>
</body>

</html>